/* const { query } = require('../utils/db');
class UserService {
  async queryUser(params, whereSql) {
    let sql = "select * from user ";
    if (params) sql += " where ?";
    return query(sql, params);
  }
  async createUser(params) {
    const sql = "insert into user set ?";
    // const res = await query(sql, params);
    return query(sql, params);
  }

}

module.exports = new UserService() */


const CRUDService = require('.');
const { query } = require('../utils/db');
class UserService extends CRUDService {
  constructor() {
    super('user');
    // this.tableName = 'user'
  }
  queryUser = async (params) => {
    let sql = `select id,name,phone from ${this.tableName} `;
    if (params) sql += ' where ? ';
      return query(sql, params || {});
  }
}

module.exports = new UserService()